﻿<Window x:Class="Zorbo.UI.Settings"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        xmlns:my="clr-namespace:Zorbo.UI"
        Title="Zorbo - Settings manager" 
        Height="345"
        Width="526"
        Icon="/Zorbo.UI;component/Zorbo.ico" 
        ResizeMode="CanResize" 
        WindowStartupLocation="CenterScreen">

    <Grid Background="WhiteSmoke">
        <Path Data="{StaticResource BezierGeometry}"
	          Fill="{StaticResource BezierBrush}"
	          Opacity="0.2" 
	          Stroke="Black"
	          StrokeThickness="1"
	          Height="66" 
	          Stretch="Fill" 
	          VerticalAlignment="Top" >
            <Path.Effect>
                <DropShadowEffect BlurRadius="12" ShadowDepth="1" Opacity="0.55" Direction="270"/>
            </Path.Effect>
        </Path>

        <Grid x:Name="LayoutRoot" Margin="0,60,0,0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="120" MaxWidth="250" />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>

            <Popup x:Name="HelpPopup" 
               IsOpen="{Binding Path=Help.IsOpen, RelativeSource={RelativeSource AncestorType={x:Type Window}}}" 
               PlacementTarget="{Binding Path=Help.Control, RelativeSource={RelativeSource AncestorType={x:Type Window}}}"
               StaysOpen="False" 
               AllowsTransparency="True">
                <Grid>
                    <Border Margin="0,0,5,5" 
                        Background="AliceBlue" 
                        BorderBrush="Black" 
                        BorderThickness="1"
                        CornerRadius="2"
                        Effect="{StaticResource PopupShadow}">
                        <TextBlock x:Name="HelpText" 
                               Margin="5"
                               Text="{Binding Path=Help.Text, RelativeSource={RelativeSource AncestorType={x:Type Window}}}"/>
                    </Border>
                </Grid>
            </Popup>

            <TreeView BorderBrush="#FFDBDBDB" BorderThickness="0,0,1,0">
                <TreeViewItem x:Name="optGeneral" Header="General" IsSelected="True"/>
                <TreeViewItem x:Name="optChatroom" Header="Chat"/>
                <TreeViewItem x:Name="optLogins" Header="Logins"/>
                <TreeViewItem x:Name="optPlugins" Header="Plugins" IsExpanded="True" />
                <TreeViewItem x:Name="optAdvanced" Header="Advanced"/>
            </TreeView>

            <GridSplitter Width="3" Background="Transparent" HorizontalAlignment="Right" />

            <my:General DataContext="{Binding Path=Config}" Grid.Column="1" Visibility="{Binding Path=IsSelected, ElementName=optGeneral, Converter={StaticResource BooleanToVisibility}}" />
            <my:Chat DataContext="{Binding Path=Config}" Grid.Column="1" Visibility="{Binding Path=IsSelected, ElementName=optChatroom, Converter={StaticResource BooleanToVisibility}}" />
            <my:Logins DataContext="{Binding Path=History}" Grid.Column="1" Visibility="{Binding Path=IsSelected, ElementName=optLogins, Converter={StaticResource BooleanToVisibility}}" />
            <my:Plugins DataContext="{Binding Path=PluginHost}" Grid.Column="1" Visibility="{Binding Path=IsSelected, ElementName=optPlugins, Converter={StaticResource BooleanToVisibility}}" />
            <my:Advanced DataContext="{Binding Path=Config}" Grid.Column="1" Visibility="{Binding Path=IsSelected, ElementName=optAdvanced, Converter={StaticResource BooleanToVisibility}}" />
        </Grid>
    </Grid>
</Window>
